import { createApp } from "vue";
import {
  NavBar,
  Swipe,
  SwipeItem,
  PullRefresh,
  Dialog,
  Overlay,
  Toast,
  Popover,
  Field,
  List,
  Empty,
  Popup
} from "vant";
// import {createPinia} from 'pinia';

import App from "./App.vue";
import router from "./router";
import i18n from "./i18n.js";
import store from './store/store';
// import 'amfe-flexible/index.js';
import "vant/lib/index.css";
// import 'vant/es/toast/style';
// import 'vant/es/notify/style';
// import 'vant/es/dialog/style';
import "@/assets/styles/initialize.css";
// import '@/assets/styles/base.css';
// import req from '@/libs/req';

const app = createApp(App);
app.use(store);
// app.prototype.api = req

// app.use(createPinia());
app.use(router);
app.use(NavBar);
app.use(Swipe);
app.use(SwipeItem);
app.use(PullRefresh);
app.use(Dialog);
app.use(Overlay);
app.use(Toast);
app.use(Popover);
app.use(Field);
app.use(List);
app.use(Empty);
app.use(Popup);
app.use(i18n);

router.beforeEach((to) => {
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  // if (!req.defaults.headers['token'] && to.path !== '/') {
  //     router.replace({
  //         path: '/'
  //     })
  // }
});

app.mount("#app");
